/* 
Added by Paul to control Querying with notification on cursor 
*/
package poler.util
{
	import flash.display.DisplayObject;
	import mx.core.Application;
	import mx.core.IFlexDisplayObject;
	import mx.managers.CursorManager;
	import mx.managers.CursorManagerPriority;
	import mx.managers.PopUpManager;
	import mx.styles.StyleManager;

	public class ProgressHandler {
		
		private static var progressShowing:Boolean = false;
		private static var popDO:IFlexDisplayObject = null;
		private static var cursorID:Number = 0;
		
		public static function ShowProgressPopUp(popParent:DisplayObject):void {
			if (!progressShowing) {
				popDO = PopUpManager.createPopUp(popParent, null, true);
				PopUpManager.centerPopUp(popDO);
				PopUpManager.bringToFront(popDO);
				progressShowing = true;
			}
		}
		public static function HideProgressPopUp():void {
			
			if (progressShowing && (popDO != null)) {
				PopUpManager.removePopUp(popDO);
				popDO = null;
				progressShowing = false;
			}
			
		}
		//
		public static function IsBusyView(target:Object = null):void {
			cursorID = CursorManager.setCursor(StyleManager.getStyleDeclaration("CursorManager").getStyle("busyCursor"),CursorManagerPriority.HIGH);
			if(target != null){
				target.enabled = false;
			}
		}
		public static function IsNotBusyView(target:Object = null):void {
			CursorManager.removeCursor(cursorID);
			if(cursorID > 0){
				cursorID--;
			}
			if(target != null){
				target.enabled = true;
			}
		}
		
//
	}
}